/*
 * Copyright 2012-2014 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.jqd.examples.jpa2.idmapping;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.TableGenerator;

/**
 * TODO
 * 
 * @author liaozhicheng.cn@gmail.com
 * @date 2012-9-2
 * @since 1.0
 */
@Entity
@Access(AccessType.FIELD)
class TableGeneratorEntity {
	
	@Id
	@GeneratedValue(strategy=GenerationType.TABLE, generator = "entity1_generator")
	@TableGenerator(name = "entity1_generator", 
		table = "ID_GENERATOR", 
		pkColumnName = "GEN_NAME", 
		valueColumnName = "GEN_VALUE", 
		pkColumnValue = "entity1_gen", 
		initialValue = 100, // 这个初始值好像不起作用
		allocationSize = 100)
	// allocationSize = 10 预分配标识大小，为避免每次请求标识都更新数据库，使用预分配大小，应用程序先分配一批标识，在请求时从内存中生成标识
	private long id;
	
	private String name;
	
	
	public long getId() {
		return id;
	}
	
	
	public void setId(long id) {
		this.id = id;
	}
	
	
	public String getName() {
		return name;
	}
	
	
	public void setName(String name) {
		this.name = name;
	}
	
}
